# Contributor: Hoang Nguyen <folliekazetani@protonmail.com>
# Maintainer: Hoang Nguyen <folliekazetani@protonmail.com>
pkgname=popeye
pkgver=0.11.2
pkgrel=0
pkgdesc="Kubernetes cluster resource sanitizer"
url="https://popeyecli.io/"
arch="all"
license="Apache-2.0"
makedepends="go"
source="$pkgname-$pkgver.tar.gz::https://github.com/derailed/popeye/archive/refs/tags/v$pkgver.tar.gz"

export GOCACHE="${GOCACHE:-"$srcdir/go-cache"}"
export GOTMPDIR="${GOTMPDIR:-"$srcdir"}"
export GOMODCACHE="${GOMODCACHE:-"$srcdir/go"}"

build() {
	GOLDFLAGS="
	-X github.com/derailed/popeye/cmd.version=v$pkgver
	-X github.com/derailed/popeye/cmd.commit=AlpineLinux
	-X github.com/derailed/popeye/cmd.date=$(date +%FT%T%Z)
	"
	go build -v -tags netgo -o bin/$pkgname -ldflags "$GOLDFLAGS"
}

check() {
	go test ./...
}

package() {
	install -Dm755 bin/$pkgname "$pkgdir"/usr/bin/$pkgname
}

sha512sums="
78087b78b2c432d957a6598c51872acbb6189072028f6c22b72599aa4e279e1b64709c5f1cd6389de594993bb9e04cf88a4f8f16956d18f8d5a135ac81af5fe5  popeye-0.11.2.tar.gz
"
